﻿using Missbot.Common;

namespace Missbot.AIModule
{
    public class DailyLimitSvc : ISingleton
    {
        public bool Check(string UserID, string cmdID, int cmdLimit)
        {
            if (cmdLimit == 0)
            {
                return true;
            }
            
            var limitRecord = DailyLimitDA.Get(UserID, cmdID);
            return limitRecord.Check(cmdLimit);
        }

        public void Cache(string UserID, string cmdID)
        {
            var limitRecord = DailyLimitDA.Get(UserID, cmdID);
            limitRecord.Cache();
            limitRecord.Update();
        }
    }
}